using CommandLine;
using Viyi.Strings.Extensions;

namespace JamesFan.FetchAreaCodes.Cli;

abstract class DbOptions : CliOptions {
    [Option('g', "config", Group = "config", HelpText = "数据库配置文件 (JSON)")]
    public string? ConfigFile { get; set; }

    [Option('s', "conn", Group = "config", HelpText = "数据库连接字符串")]
    public string? ConnectionString { get; set; }

    public override void Validate() {
        base.Validate();
        if (!ConfigFile.IsEmpty() && !ConnectionString.IsEmpty()) {
            throw new ArgumentException("--config(-g) 和 --conn(-s) 只能指定其中一项");
        }
    }
}

[Verb("mysql", HelpText = "输出到 MySQL 数据库")]
class MysqlOptions : DbOptions { }
